#ifndef INCLUDED_RESOURCE_H
#define INCLUDED_RESOURCE_H

#include "lib/containers/hash_table.h"


class Shape;
class SoundScript;


class Resource
{
protected:
	unsigned int				m_nameSeed;

	HashTable<int>				m_displayLists;
    
	HashTable<int>				m_textures;
	HashTable<Shape *>			m_shapes;
	HashTable<SoundScript *>	m_soundScripts;

public:
    Resource();
	~Resource();

	int				CreateDisplayList	(char const *name);	// Adds _name to the hashtable and calls glGenLists
	int				GetDisplayList		(char const *name);	// Returns -1 if _name doesn't exist
	void			DeleteDisplayList	(char const *name);	// Removes _name from the hashtable and calls glDeleteLists

	int             GetTexture			(char const *name, bool mipMapping=true, bool masked=true);
	Shape			*GetShape			(char const *name);
	SoundScript     *GetSoundScript		(char const *name);

    void			FlushOpenGlState	();
	void			RegenerateOpenGlState();

	// Returns a unique name that can be used to identify autogenerated resources. It is the caller's 
	// responsibility to delete the name later. Use "delete []" NOT "free".
	char			*GenerateName		();	
};



extern Resource g_resourceManager;


#endif
